<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	
	<body>
		
		<div>
			<a name="tb" href="http://www.taobao.com" target="_blank">淘宝</a>
			<a class="jd" href="http://www.jd.com" target="_blank">京东</a>
			<a id="pdd" href="http://www.pinduoduo.com" target="_blank">拼夕夕</a>
		</div>
		
		<script>
			//name属性方式
			var tb = document.getElementsByName("tb")[0].href;
			console.log(tb);
			//class属性方式
			var jd=document.getElementsByClassName("jd")[0].href;
			console.log(jd);
			//id属性方式
			var pdd=document.getElementById("pdd").href;
			console.log(pdd);
		</script>
		
	</body>
</html>
